package com.bw.user.adapter;

import com.bw.mvvm_common.network.load.LoadImage;
import com.bw.user.R;
import com.bw.user.entity.OrderListEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

/**
 * @author KK
 * @description:
 * @date :2021/11/2 14:29
 */
public class OrderListAdapter extends BaseQuickAdapter<OrderListEntity.DataBean, BaseViewHolder> {
    public OrderListAdapter() {
        super(R.layout.item_allorder);
        addChildClickViewIds(R.id.item_allorder_cancle);
        addChildClickViewIds(R.id.item_allorder_confirm);
        addChildClickViewIds(R.id.item_allorder_pay);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, OrderListEntity.DataBean dataBean) {
//        int orderStatus = dataBean.getOrderStatus();
//        if(orderStatus == 0){
//
//        }
        for (int i = 0; i < dataBean.getOrderGoodsList().size(); i++) {
            baseViewHolder.setText(R.id.item_allorder_tv,dataBean.getOrderGoodsList().get(i).getGoods_desc());
            baseViewHolder.setText(R.id.item_allorder_title,dataBean.getOrderGoodsList().get(i).getGoods_sku());
            baseViewHolder.setText(R.id.item_allorder_price,dataBean.getOrderGoodsList().get(i).getGoods_price());
            baseViewHolder.setText(R.id.item_allorder_stu,""+dataBean.getOrderStatus());
            LoadImage.loadMatchImg(dataBean.getOrderGoodsList().get(i).getGoods_icon(),baseViewHolder.getView(R.id.item_allorder_im));
        }
    }
}
